<?php

use Illuminate\Database\Seeder;
use App\System\Base\Model\BaseNotification;
use Faker\Factory;

class BaseNotificationTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run(BaseNotification $baseNotification)
    {
        //先清空表
        $baseNotification->truncate();
        //实例化faker类
        $faker = Factory::create('zh_CN');//生成中文数据
        //循环
        for ($i = 0; $i < 30; $i++) {
            $baseNotification->insert([
                'title'       => $faker->title,
                'image_id'    => mt_rand(1, 5),
                'content'     => $i + 1,
                'target_type' => mt_rand(0, 2),
                'device_type' => mt_rand(0, 6),
                'target'      => mt_rand(1, 20),
                'action_type' => '1',
                'plan_time'   => date('Y-m-d', time()),
                'status'      => '1',
                'admin_id'    => mt_rand(0, 1),
                'created_at'  => date('Y-m-d H:i:s', time()),
            ]);
        }
    }
}
